// Decompiled by GOOSIN CO,LTD Copyright 2010 Pavel Kouznetsov.
// home page: http://www.Goosin.net
// Decompiler options: packimports(3) fieldsfirst ansi space 
// Source File Name:   creditRate_change_ok.java

package crm.config.intranalyse;

import include.nseer_cookie.counter;
import include.nseer_cookie.exchange;
import include.nseer_db.nseer_db_backup1;
import java.io.IOException;
import java.sql.ResultSet;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import javax.servlet.http.*;
import javax.servlet.jsp.JspFactory;

public class creditRate_change_ok extends HttpServlet
{

	ServletContext application;
	HttpSession session;
	nseer_db_backup1 erp_db;

	public creditRate_change_ok()
	{
		erp_db = null;
	}

	public synchronized void doPost(HttpServletRequest request, HttpServletResponse response)
		throws IOException, ServletException
	{
		HttpSession dbSession = request.getSession();
		JspFactory _jspxFactory = JspFactory.getDefaultFactory();
		javax.servlet.jsp.PageContext pageContext = _jspxFactory.getPageContext(this, request, response, "", true, 8192, true);
		ServletContext dbApplication = dbSession.getServletContext();
		try
		{
			java.io.PrintWriter out = response.getWriter();
			nseer_db_backup1 security_db = new nseer_db_backup1(dbApplication);
			if (security_db.conn((String)dbSession.getAttribute("unit_db_name")))
			{
				counter count = new counter(dbApplication);
				String human_ID = request.getParameter("human_ID");
				String human_name = exchange.unURL(request.getParameter("human_name"));
				String credit_discount = request.getParameter("credit_discount");
				credit_discount = credit_discount.replaceAll(",", "");
				String sqll = (new StringBuilder("select * from security_users where human_ID='")).append(human_ID).append("'").toString();
				ResultSet rs = security_db.executeQuery(sqll);
				if (!rs.next())
				{
					response.sendRedirect("crm/config/intranalyse/creditRate_change_ok_a.jsp");
				} else
				{
					String sql2 = (new StringBuilder("update security_users set credit_discount='")).append(credit_discount).append("' where human_ID='").append(human_ID).append("'").toString();
					security_db.executeUpdate(sql2);
					response.sendRedirect("crm/config/intranalyse/creditRate_change_ok_b.jsp");
				}
				security_db.commit();
				security_db.close();
			} else
			{
				response.sendRedirect("error_conn.htm");
			}
		}
		catch (Exception exception) { }
	}
}
